package com.owc.common.configuration;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;


/**
 * @Author Jackies
 * @Date 2019/12/1 15:20
 * @Description TODO://
 **/
@Component
public class OwcConfig {
    /**
     * JWT私钥
     */
    public static String jwtSecret;
    /**
     * XXTEA解密key
     */
    public static String encryKey;
    /**
     * JWT默认过期时间
     */
    public static Long jwtExpireTime;
    /**
     * Http超时时间
     */
    public static Integer httpConnectTime;

    public static Integer httpReadTime;
    /**
     * 钱包服务ip地址
     */
    public static String walletHost;
    /**
     * 钱包服务端口
     */
    public static String walletPort;

    @Value("${jwt.secret}")
    public void setJwtSecret(String jwtSecret) {
        OwcConfig.jwtSecret = jwtSecret;
    }

    @Value("${encryption.key}")
    public void setEncryKey(String encryKey) {
        OwcConfig.encryKey = encryKey;
    }

    @Value("${jwt.expireTime}")
    public void setJwtExpireTime(Long jwtExpireTime) {
        OwcConfig.jwtExpireTime = jwtExpireTime;
    }

    @Value("${http.connection.timeout}")
    public void setHttpConnectTime(Integer httpConnectTime) {
        OwcConfig.httpConnectTime = httpConnectTime;
    }

    @Value("${http.read.timeout}")
    public void setHttpReadTime(Integer httpReadTime) {
        OwcConfig.httpReadTime = httpReadTime;
    }

    @Value("${wallet.host}")
    public void setWalletHost(String walletHost) {
        OwcConfig.walletHost = walletHost;
    }

    @Value("${wallet.port}")
    public void setWalletPort(String walletPort) {
        OwcConfig.walletPort = walletPort;
    }
}
